package sample.test{
	import flash.events.Event;
	import com.takanafu.haruframework.aop.reflect.MethodImpl;
	import flash.net.URLRequest;
	import flash.net.URLLoader;
	import com.takanafu.haruframework.d2l.invoker.MethodInfo;
	import com.takanafu.haruframework.d2l.util.ApplicationContext;
	import mx.events.FlexEvent;

	public class ApplicationImpl{
		private var cm:ConsoleManager;
		
		public function ApplicationImpl(){
			super();
			cm = ApplicationContext.getBean("consoleManager") as ConsoleManager;
			cm.println("ApplicationImpl:Constructor["+this+"]");
		}
		
		public function ApplicationEventHandler(event:Event,method:MethodImpl=null):void{
			if(event.type == FlexEvent.APPLICATION_COMPLETE){
				cm.window = event.target.window;
			}
			cm.println(event.target.toString()+" の "+event.type+" イベントが呼ばれました。");
		}
		
		public function clearConsole(event:Event,method:MethodImpl=null):void{
			cm.clear();
		}
		
		/*
		public function onInitialize(event:Event,method:MethodImpl=null):void{
			trace("["+event.type+"]イッヒー！！");
		}
		
		public function moge(event:Event,method:MethodImpl=null):MethodInfo{
			trace("もげー");
			var ret:MethodInfo = null;
			
			if(method != null){
				var req:URLRequest = new URLRequest("qint3.txt");
				var loader:URLLoader = new URLLoader();
				
				loader.addEventListener(Event.COMPLETE,method.invoker.handler);
				loader.load(req);
				ret = new MethodInfo(initializeHandler,MethodInfo.USE_HANDLER);
			}
			
			return ret;
		}
		
		private function initializeHandler(event:Event):void{
			trace(event.target.data);
		}
		
		public function moge2(event:Event,method:MethodImpl=null):void{
			throw new Error("わざとエラー");
		}
		static public function aaa():void{
			
		}
		*/
	}
}